<?php


namespace app\ticket\controller;

use think\Db;

class Index
{



    public function getTicketGrantUserList()
    {
        $sql = "SELECT id, company_code, wxuid, pwxuid, state, mobile, level, headimg, nickname, apply_state, apply_total_num,
  apply_surplus_num, city, city_id, apply_num, cc.sum as apply_receive_num, company
FROM sk_wx_user_taopiao_role sr left join (SELECT Substr(aa, 3, Length(aa)) AS wxuid_level1, sum
                                           FROM (SELECT substring_index(wxuids, '', 2) AS aa,
                                                   Sum(apply_receive_num) AS sum
                                                 FROM sk_wx_user_taopiao_role
                                                 GROUP BY substring_index(wxuids, '', 2)) bb) cc
on sr.wxuid = cc.wxuid_level1
WHERE state = 1 and level = 1";

        $list = Db::query($sql);
        return json($list);
    }
    public function index(){
        $data = ['errmsg'=>'你好啊'];
        return json($data);
    }
}